package thirdsample.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.concurrent.atomic.AtomicLong;
import java.util.*; 

@Controller
public class ThirdSampleController {

	private final AtomicLong counter = new AtomicLong();
	
	@RequestMapping("")
	public String loadHomePage(Model m) {
	System.out.println("######## calling /");
		Calendar c = Calendar.getInstance(); 

		int year = c.get(c.YEAR); 
		int month = c.get(c.MONTH)+1; 
		int day = c.get(c.DAY_OF_MONTH);
		m.addAttribute("date", day + "." + month + "." + year);
		m.addAttribute("siteUpdateCount", counter.incrementAndGet());
		return "index";
	}
}
